﻿namespace PortableRiotGames.Interfaces.Stats
{
    using Newtonsoft.Json;
    using PortableRiotGames.Infrastructure;
    using PortableRiotGames.Infrastructure.Converters;
    using System;
    using System.Collections.Generic;

    [JsonObject(MemberSerialization.OptIn)]
    public sealed class GetSummaryResponse : ResponseBase
    {
        /// <summary>
        /// List of player stats summaries associated with the summoner.
        /// </summary>
        [JsonProperty("playerStatSummaries")]
        public List<GetSummaryResponsePlayerStatsSummary> PlayerStatSummaries { get; set; }

        /// <summary>
        /// Summoner id associated with player.
        /// </summary>
        [JsonProperty("summonerId")]
        public long SummonerID { get; set; }
    }

    [JsonObject(MemberSerialization.OptIn)]
    public sealed class GetSummaryResponsePlayerStatsSummary
    {
        /// <summary>
        /// Number of losses for this queue type. Returned for ranked queue types only.
        /// </summary>
        [JsonProperty("losses")]
        public int Losses { get; set; }

        /// <summary>
        /// Date stats were last modified converted from epoch milliseconds.
        /// </summary>
        [JsonProperty("modifyDate")]
        [JsonConverter(typeof(JsonDateTimeMiliConverter))]
        public DateTime ModifyDate { get; set; }

        /// <summary>
        /// Player stats summary type.
        /// </summary>
        [JsonProperty("playerStatSummaryType")]
        [JsonConverter(typeof(JsonEnumStringConverter<PlayerStatSummaryType>))]
        public PlayerStatSummaryType PlayerStatSummaryType { get; set; }

        /// <summary>
        /// Aggregated stats.
        /// </summary>
        [JsonProperty("aggregatedStats")]
        public AggregatedStats Stats { get; set; }

        /// <summary>
        /// Number of wins for this queue type.
        /// </summary>
        [JsonProperty("wins")]
        public int Wins { get; set; }
    }
}